package flca.voicenav.util;


public class GetNaturalDirection {

	private static String sDirections[] = new String[] {"left ", "right "};
	private static int LEFT = 0;
	private static int RIGHT = 1;
	
	public static String getAngleAsString(double angle)
	{
 		int dir = LEFT; //assume
 		
		if (angle < 0.0)  {
			if (angle > -90) {
				angle = -angle;
				dir = RIGHT;
			} else if (angle > -180) {
				angle = 180 + angle;
			} else {
				angle = 360 + angle;
			}
		} else {
			if (angle < 90) {
			} else if (angle < 180) {
				angle = 180 - angle;
			} else {
				angle = 360 - angle;
				dir = RIGHT;
			}
		}

		
		int a = rounded(angle);
		if (a > 20) {
			return sDirections[dir] + rounded(angle);
		} else {
			return "";
		}
	}

	private static int rounded(double aValue) {
		return ((int) Math.round(aValue/10.0)) * 10;
	}
	
}
